<HTML><HEAD><TITLE>get_flag(?Flag, -Value)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Development Environment and Global Settings</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>get_flag(?Flag, -Value)</H1>
Succeeds if the flag Flag has the value Value.


<DL>
<DT><EM>Flag</EM></DT>
<DD>Atom or Variable.
</DD>
<DT><EM>Value</EM></DT>
<DD>Prolog term.
</DD>
</DL>
<H2>Description</H2>
   Used to return or check the environment flag Flag with value Value.  The
   environment flags which are read/write may be updated using set_flag/2.
   The current values of the environment flags are returned by env/0.
<P>
   The following list details the environment flags:
<DL>
<DT><STRONG>after_event_timer</STRONG><DD>

<P>
    Access mode :   read/write

<P>
    Type :  Atomic constant <EM>real</EM> or <EM>virtual</EM>

<P>
    Description : Specifies the timer used for event_after/2 and
        event_after_every/2.

<P>
<DT><STRONG>break_level</STRONG><DD>

<P>
    Access mode :   read/write

<P>
    Type :   Integer

<P>
    Description :   Specifies current nesting level of recursive
        top-level loops.

<P>
<DT><STRONG>breal_exceptions</STRONG><DD>

<P>
    Access mode :   read/write

<P>
    Type :   Atomic constant <EM>on</EM> or <EM>off</EM>

<P>
    Default :   off

<P>
    Description :   If <EM>on</EM>,  unifying or testing bounded reals
	for identity raises an 'undecidable comparison of bounded reals'
	exception in case the comparison is undecidable (i.e. the bounds
	overlap).  If <EM>off</EM>, bounded reals compare equal when
	their bounds are equal.  This flag does not affect arithmetic
	comparisons.

<P>
<DT><STRONG>coroutine</STRONG><DD>

<P>
    Access mode :   read/write

<P>
    Type :   Atomic constant <EM>on</EM> or <EM>off</EM>

<P>
    Default :   configuration dependent

<P>
    Description :   Specifies whether built-in predicates delay or
        raise instantiation faults.

<P>
<DT><STRONG>cwd</STRONG><DD>

<P>
    Access mode :   read/write

<P>
    Type :   String

<P>
    Description :   Specifies the name of the current working
        directory.  May also be set using cd/1 or read using getcwd/1.

<P>
<DT><STRONG>debug_compile</STRONG><DD>

<P>
    Access mode :   read/write

<P>
    Type :   Atomic constant <EM>on</EM> or <EM>off</EM>

<P>
    Default :   on

<P>
    Description :   Specifies whether clauses are compiled for
        debugging or not.  May be overwritten on a file by file
	basis using pragma(debug) or pragma(nodebug).

<P>
<DT><STRONG>debugging</STRONG><DD>

<P>
    Access mode : read-only

<P>
    Type : Atomic constant <EM>nodebug</EM>, <EM>creep</EM>, or <EM>leap</EM>

<P>
    Default :   nodebug

<P>
    Description : Specifies whether debugging is disabled (nodebug) or
    	enabled.  trace/0 sets the creep mode, debug/0 sets the leap mode.

<P>
<DT><STRONG>default_language</STRONG><DD>

<P>
    Access mode : read/write

<P>
    Type : Atom

<P>
    Default :   eclipse_language

<P>
    Description : Specifies the source language dialect for modules which
    	are created without an explicit language specification (module/1
	directive or the create_module/1). Other possible settings are
	for example 'iso' or 'sicstus'.

<P>

<P>
<DT><STRONG>eclipse_info_suffix</STRONG><DD>

<P>
    Access mode : read

<P>
    Type : String

<P>
    Default : ".eci"

<P>
    Description : Specifies the ECLiPSe information file suffix used when a 
        file is generated by icompile/1. The suffix will be automatically
        appended to the base file name when the information file is 
        generated. 

<P>
<DT><STRONG>eclipse_object_suffix</STRONG><DD>

<P>
    Access mode : read

<P>
    Type : String

<P>
    Default : ".eco"

<P>
    Description : Specifies the ECLiPSe object file suffix used when a file
        is fcompiled. The suffix will be automatically appended to the 
        file's base name when the object file is generated. When loading a 
        file (e.g. use_module/1, lib/1), the system will try to find an
        object file before a source file by appending the given suffix
        before the source suffix(es).

<P>
<DT><STRONG>enable_interrupts</STRONG><DD>

<P>
    Access mode : read/write

<P>
    Type : Atomic constant <EM>on</EM> or <EM>off</EM>

<P>
    Default :   on

<P>
    Description : If on, interrupts are recognised and processed as
        they occur.  If off, interrupts are entered into a delay queue
        and processed only when the flag is switched back to on.
        Interrupts should be disabled only for short periods of time in
        order to keep the system's interrupt response time short.

<P>
<DT><STRONG>extension</STRONG><DD>

<P>
    Access mode : read-only

<P>
    Type : Atomic constant.

<P>
    Default :   configuration dependent

<P>
    Description : Specifies which extensions are available in the
        system.  This flag may contain multiple values and will return
        them on backtracking.

<P>
<DT><STRONG>float_precision</STRONG><DD>

<P>
    Access mode : read-only

<P>
    Type : Atomic constant

<P>
    Default :   double

<P>
    Description : This flag is obsolete. Its value is always <EM>double</EM>.

<P>
<DT><STRONG>gc</STRONG><DD>

<P>
    Access mode :   read/write

<P>
    Type :   Atomic constant <EM>on</EM>, <EM>verbose</EM> or <EM>off</EM>

<P>
    Default :   on

<P>
    Description :   Specifies whether garbage collection is enabled
        (on), disabled (off) or enabled and reports every collection on
        log_output (verbose).

<P>
<DT><STRONG>gc_policy</STRONG><DD>

<P>
    Access mode :   read/write

<P>
    Type :   Atomic constant <EM>adaptive</EM> or <EM>fixed</EM>.

<P>
    Default :   adaptive

<P>
    Description :   This option affects the triggering heuristics of
	the garbage collector, together with the gc_interval setting.
	The <EM>adaptive</EM> policy minimises garbage collection time,
	while the <EM>fixed</EM> policy minimises space consumption.

<P>
<DT><STRONG>gc_interval</STRONG><DD>

<P>
    Access mode :   read/write

<P>
    Type :   Integer

<P>
    Default :   1/32 of global stack size, at least 64KB

<P>
    Description :   Specify how often the collector is invoked.
	Roughly, the argument specifies the minimum number of bytes a
	program must have newly allocated before a garbage collection
	is triggered.  If the garbage collector runs frequently while
	reclaiming little space it may make sense to increase
	gc_interval, thus reducing the number of garbage collections. 
	This is normally only necessary when the gc_policy is set to
	<EM>fixed</EM>.  With gc_policy set to <EM>adaptive</EM>, the
	collection intervals will be adjusted automatically.  See also
	gc_policy setting.

<P>
<DT><STRONG>gc_interval_dict</STRONG><DD>

<P>
    Access mode :   read/write

<P>
    Type :   Integer

<P>
    Default :   960

<P>
    Description :   Specify after how many new dictionary entries the
        dictionary garbage collector is invoked.

<P>
<DT><STRONG>goal_expansion</STRONG><DD>

<P>
    Access mode :   read/write

<P>
    Type :   Atomic constant <EM>on</EM> or <EM>off</EM>

<P>
    Default :   on

<P>
    Description :   Specifies whether goal expansion (inling) is done by
	the compiler or other source processing tools.  Can be disabled
	for debugging purposes, but usually it is preferable to use a
	compiler/source-processor option or a pragma for this purpose.

<P>
<DT><STRONG>hostarch</STRONG><DD>

<P>
    Access mode : read-only

<P>
    Type : String

<P>
    Description : String identifying the host processor and operating
        system.  It is also the name of the machine-dependent
        subdirectories in the ECLiPSe installation.

<P>
<DT><STRONG>hostid</STRONG><DD>

<P>
    Access mode : read-only

<P>
    Type : String

<P>
    Description : The unique identification of the host machine that
        the system is running on.

<P>
<DT><STRONG>hostname</STRONG><DD>

<P>
    Access mode : read-only

<P>
    Type : string

<P>
    Description : The name of the current host machine.

<P>
<DT><STRONG>ignore_eof</STRONG><DD>

<P>
    Access mode : read/write

<P>
    Type :   Atomic constant <EM>on</EM> or <EM>off</EM>

<P>
    Description : Controls whether ECLiPSe can be exited by typing an
        end-of-file to the toplevel-prompt or whether this is ignored.
        If ignored, ECLiPSe can be exited by calling halt/0.

<P>
<DT><STRONG>installation_directory</STRONG><DD>

<P>
    Access mode : read-only

<P>
    Type : string

<P>
    Description : The name of the toplevel directory of the running
        ECLiPSe installation.  All ECLiPSe library, documentation and
        other directories are below this one.

<P>
<DT><STRONG>last_errno</STRONG><DD>

<P>
    Access mode : read-only

<P>
    Type : Integer

<P>
    Description : The error code that the most recent failed operating
        system call returned. This should no longer be used because of
        portability problems, use errno_id/1 instead.

<P>
<DT><STRONG>library_path</STRONG><DD>

<P>
    Access mode : read/write

<P>
    Type : List of strings

<P>
    Default :   the contents of the user's ECLIPSELIBRARYPATH
        environment variable, followed by the system library
        directories

<P>
    Description : Specifies the list of pathnames used by the system to
        search for library files.  The library path is used by lib/1
        for autoloading, and to expand library/1 structures in
        pathnames.

<P>
<DT><STRONG>loaded_library</STRONG><DD>

<P>
    Access mode :   read/write

<P>
    Type :   Atom

<P>
    Description :   Returns the names of the currently loaded
        libraries.  This flag may contain multiple values and will
        return them on backtracking.

<P>
<DT><STRONG>macro_expansion</STRONG><DD>

<P>
    Access mode :   read/write

<P>
    Type :   Atomic constant <EM>on</EM> or <EM>off</EM>

<P>
    Default :   on

<P>
    Description :   Specifies whether macro expansion (including clause
    	expansion and goal expansion/inlining) is enabled or disabled.
	Should be disabled only for very specific debugging purposes.
	It is preferrable to disable macro expansion on a per-stream
	basis (see set_stream_property/3) or via a source-processor option.

<P>
<DT><STRONG>max_integer</STRONG><DD>

<P>
    Access mode : read-only

<P>
    Type : Integer

<P>
    Description :   If the range of integer is bounded (i.e. bignums not
       supported), returns the maximum representable integer value. Fails 
       if the integer range is unbounded. 

<P>
<DT><STRONG>max_global_trail</STRONG><DD>

<P>
    Access mode : read-only

<P>
    Type : Integer

<P>
    Description : The maximum size in bytes to which the global/trail stack
        can grow. See also statistics/2.

<P>
<DT><STRONG>max_local_control</STRONG><DD>

<P>
    Access mode : read-only

<P>
    Type : Integer

<P>
    Description : The maximum size in bytes to which the global/trail stack
        can grow. See also statistics/2.

<P>
<DT><STRONG>max_predicate_arity</STRONG><DD>

<P>
    Access mode :   read-only

<P>
    Type :   Integer

<P>
    Default :   255

<P>
    Description :   Returns the maximum number of arguments allowed for
        an ECLiPSe predicate.

<P>
<DT><STRONG>object_suffix</STRONG><DD>

<P>
    Access mode :   read-only

<P>
    Type :   String

<P>
    Description :   Returns the suffix of the external object files
        that can be loaded using load/1.  It is usually "so" for
        systems that support shared libraries and "o" for the others.

<P>
<DT><STRONG>occur_check</STRONG><DD>

<P>
    Access mode : read/write

<P>
    Type :   Atomic constant <EM>on</EM> or <EM>off</EM>

<P>
    Default :   off

<P>
    Description : If the flag is on, occur check is performed on
        uncompiled unifications and the compiler generates code for
        unifications that will perform the occur check when necessary.
        Note that as ECLiPSe built-ins are compiled with this flag off,
        so the occur check is never performed with built-ins.

<P>
<DT><STRONG>output_mode</STRONG><DD>

<P>
    Access mode : read/write

<P>
    Type : String

<P>
    Default :   "QPm"

<P>
    Description : The value is a control string that is recognised by
        the %w format of printf/3.  This format is used to output
        results on the toplevel loop and to print debugger trace lines.
	See also the output_options flag.

<P>
<DT><STRONG>output_options</STRONG><DD>

<P>
    Access mode : read/write

<P>
    Type : List of structures

<P>
    Default :   [depth(20), attributes(pretty), ...]

<P>
    Description : The value is an output options list as understood by
    	write_term/2,3.   This format is used to output results on the
	toplevel loop and to print debugger trace lines.  This flag is
	an alternative, more readable representation of the values of the
	print_depth and output_mode flag.  It reflects the values of those
	flags and will change their values whenever it is changed itself.

<P>
<DT><STRONG>pid</STRONG><DD>

<P>
    Access mode :   read-only

<P>
    Type :   Integer

<P>
    Description :   Returns the process identifier of the current
        ECLiPSe .

<P>
<DT><STRONG>ppid</STRONG><DD>

<P>
    Access mode :   read-only

<P>
    Type :   Integer

<P>
    Description :   Returns the process identifier of the current
        ECLiPSe 's parent process.

<P>
<DT><STRONG>prefer_rationals</STRONG><DD>

<P>
    Access mode :   read/write

<P>
    Type :   Atomic constant <EM>on</EM> or <EM>off</EM>

<P>
    Default :   off

<P>
    Description :   Specifies if the result of a /-division of two
        integers gives a rational or a floating point result.  Similar
        for the result of raising an integer to a negative integral
        power.

<P>
<DT><STRONG>print_depth</STRONG><DD>

<P>
    Access mode :   read/write

<P>
    Type :   Integer

<P>
    Default :   20

<P>
    Description :   Specifies the print depth bound for printing
        compound terms.  It is not taken into account by the output
	predicates that produce machine-readable output (write_canonical,
	writeq, etc), but other I/O built-ins obey this flag.
	Identical to the depth(N) component of the output_options flag.

<P>
<DT><STRONG>prolog_suffix</STRONG><DD>

<P>
    Access mode :   read/write

<P>
    Type :   List of strings

<P>
    Default :   ["", ".ecl", ".pl"]

<P>
    Description :   Specifies the Prolog source file suffix(es) used
        when compiling files or loading libraries.  The system tries to
        find the file by appending the given suffixes in the order
        provided.

<P>
<DT><STRONG>remote_protocol_version</STRONG><DD>

<P>
    Access mode :   read only

<P>
    Type :   Integer

<P>
    Description :   Specifies the version of the protocol which this
    	Eclipse uses to communicate with remotely attached peers.  See
	Embedding and Interfacing Manual: The Remote Interface Protocol.

<P>
<DT><STRONG>syntax_option</STRONG><DD>

<P>
    Access mode :   read/write

<P>
    Type :   Atom

<P>
    Description :   Returns the names of the currently enabled syntax
        options.  This flag may contain multiple values and will return
        them on backtracking.  A syntax option is reset using
        set_flag(syntax_option, not(Flag)).  Most compatibility
        packages affect these flags as well.  The following options are
        available:

    <DL>
    <DT><EM>atom_subscripts</EM><DD>
	  allow atoms to be followed by subscripts, and parse as subscript/2.
	  Useful for parsing other languages, e.g. FlatZinc.

    <DT><EM>bar_is_no_atom</EM><DD>
	disallow the use of an unquoted vertical bar as atom or functor.

    <DT><EM>based_bignums</EM><DD>
	  Allow base notation even for integers longer than the
	  wordsize (i.e.  they are always positive).

    <DT><EM>blanks_after_sign</EM><DD>
	ignore blank space between a sign and a number (by default,
	this space is significant and will lead to the sign being
	taken as prefix operator rather than the number's sign).

    <DT><EM>blanks_in_nil</EM><DD>
          has no effect (obsolete).

    <DT><EM>curly_args_as_list</EM><DD>
	  Parse terms written as {a,b,c} as {}([a,b,c]) instead of
	  the default {}((a,b,c)).

    <DT><EM>doubled_quote_is_quote</EM><DD>
	  parse a pair of quotes within a quoted item as one
	  occurrence of the quote within the item.  If this option is
	  off (the default), consecutive string-quoted and list-quoted
	  items are parsed as a single (concatenated) item, while
	  consecutive quoted atoms are parsed as consecutive atoms.
 
    <DT><EM>general_subscripts</EM><DD>
	  allow atoms, parenthesized subterms and subscripted subterms
	  to be followed by subscripts, and parse as subscript/2.
	  Useful for parsing other languages, e.g. Zinc.

    <DT><EM>iso_base_prefix</EM><DD>
	  allow binary, octal or hexadecimal numbers to be written
	  with 0b, 0o or 0x prefix respectively, and disallow the
	  <CODE>base'number</CODE> notation.

    <DT><EM>iso_escapes</EM><DD>
	  ISO-Prolog compatible escape sequences within strings and atoms.

    <DT><EM>limit_arg_precedence</EM><DD>
	  do not allow terms with a precedence higher than 999 as
	  structure arguments, unless parenthesised.

    <DT><EM>nested_comments</EM><DD>
          allow bracketed comments to be nested.

    <DT><EM>nl_in_quotes</EM><DD>
          allow newlines to occur inside quotes (default).

    <DT><EM>no_array_subscripts</EM><DD>
	  do not allow array subscript syntax for subscript/2.

    <DT><EM>no_attributes</EM><DD>
	disallow the Eclipse specific syntax for variable attributes
	in curly braces.

    <DT><EM>no_blanks</EM><DD>
	  do not allow blanks between functor and opening parenthesis (default).

    <DT><EM>no_curly_arguments</EM><DD>
	disallow the Eclipse specific syntax for structures with
	named arguments in curly braces.

    <DT><EM>read_floats_as_breals</EM><DD>
    	read all floating point numbers as bounded reals rather than as
	floats. The resulting breal is a small interval enclosing the
	true value of the number in decimal notation.

    <DT><EM>var_functor_is_apply</EM><DD>
	allow variables as functors, and parse a term like X(A,B,C)
	as apply(X,[A,B,C]).

    <DT><EM>$VAR</EM><DD>
	  terms of the form '$VAR'(N) are printed in a special way by
	  all the predicates that obey operator declarations (i.e. 
	  write, writeq, print and partly printf).  This is only provided
	  for compatibility packages:  the use of the output options
	  of write_term/2,3 or the format options of printf/2,3 is
	  the preferred way of specifying this behaviour.
     </DL>

<P>
<DT><STRONG>tmp_dir</STRONG><DD>

<P>
    Access mode : read/write

<P>
    Type : String

<P>
    Default : configuration dependent (see Description below)

<P>
    Description : Specifies the temporary directory that ECLiPSe may use
        for storing temporary data files. <TT>Value</TT> should be an
        existing directory (in ECLiPSe's file name syntax) that the user
        can write to (set_flag/2 will fail otherwise). It is also
        recommended that the directory should reside on a local disk where
        the I/O operations are as fast as possible.  <P> By default, this
        directory is taken from the environment variable ECLIPSETMP if it
        exist. Otherwise, it is "/tmp" for Unix systems; "//C/Temp" for
        Windows. If none of these exist, it is set to the current
        working directory at start up.

<P>
<DT><STRONG>toplevel_module</STRONG><DD>

<P>
    Access mode :   read/write

<P>
    Type :   Atom

<P>
    Default :   eclipse

<P>
    Description :   The name of the current top-level module.  This is
        the caller module for all queries entered in the top-level
        loop.  By default, this is also shown in the top-level prompt.

<P>
<DT><STRONG>unix_time</STRONG><DD>

<P>
    Access mode :   read-only

<P>
    Type :   Integer

<P>
    Description :   Return the time as given by the UNIX time(3)
        function, ie.  seconds since 00:00:00 GMT, Jan 1 1970.

<P>
<DT><STRONG>variable_names</STRONG><DD>

<P>
    Access mode :   read/write

<P>
    Type :   Atomic constant <EM>on</EM>, <EM>off</EM> or <EM>check_singletons</EM>

<P>
    Default :   check_singletons

<P>
    Description :   Controls the ability to retain the source name of
        variables.  This flag affects the reading process only, i.e.
        when a variable is read (or compiled) with the flag set to on,
        it will keep its name even when the flag is switched off later.
        check_singletons is like on but additionally the compiler emits
        warnings about source variables which occur only once in a
        clause and whose name does not start with an underscore.  The
        source variable names are being created during the term input
        if this flag is not off, and then they are kept independently
        of the value of this flag.

<P>
<DT><STRONG>version</STRONG><DD>

<P>
    Access mode :   read-only

<P>
    Type :   Atom

<P>
    Description :   Returns the current version number of ECLiPSe .

<P>
<DT><STRONG>version_as_list</STRONG><DD>

<P>
    Access mode :   read-only

<P>
    Type :   List of integers

<P>
    Description :   Returns a list of integers, starting with your ECLiPSe
    	system's major version number, and ending with its build number.
	Note that this list can be used for lexicographic comparison, e.g.
	[5,3,17] @>= [5,3] or [5,3,17] @>= [5,1,24].

<P>
<DT><STRONG>worker</STRONG><DD>

<P>
    Access mode :   read-only

<P>
    Type :   Integer

<P>
    Description :   In a parallel session it returns a positive number,
        identifying the worker on which the flag inquiry was executed.
        In a sequential session 0 is returned.

<P>
<DT><STRONG>workers</STRONG><DD>

<P>
    Access mode :   read/write

<P>
    Type :   A structure Host:N, where Host is an atom and N integer

<P>
    Description :   In a parallel session it returns a positive number
        for N, which is the number of active workers on a given host
        Host.  If Host is a variable, it is bound to the host name
        where this predicate is executed.

<P>
<DT><STRONG>workerids</STRONG><DD>

<P>
    Access mode :   read-only

<P>
    Type :   A structure Host:ActiveList+AsleepList, where Host is an
        atom and ActiveList and AsleepList are integer lists

<P>
    Description :   In a parallel session it returns the workerid lists
        of of both active and asleep workers on a given host Host.  If
        Host is a variable, it is bound to the host name where this
        predicate is executed.

<P>
<DT><STRONG>wm_window</STRONG><DD>

<P>
    Access mode :   read/write

<P>
    Type :   Atomic constant <EM>on</EM> or <EM>off</EM>

<P>
    Description :   In a parallel session this flag tells if the window
        interface for the worker manager is on or off.
</DL>
<P>

<H3>Modes and Determinism</H3><UL>
<LI>get_flag(-, -) is nondet
<LI>get_flag(+, -) is nondet
</UL>
<H3>Modules</H3>
This predicate is sensitive to its module context (tool predicate, see @/2).
<H3>Exceptions</H3>
<DL>
<DT><EM>(5) type error </EM>
<DD>Flag is neither an atom nor variable.
</DL>
<H2>Examples</H2>
<PRE>
Success:
   [eclipse]: get_flag(gc, X).
   X = on

   yes.
   [eclipse]: get_flag(loaded_library, L).

   L = lists     More? (;)

   L = development_support     More? (;)
   yes.

Error:
   get_flag(1,X).           (Error 5)



</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/env/set_flag-2.html">set_flag / 2</A>, <A HREF="../../kernel/env/env-0.html">env / 0</A>, <A HREF="../../kernel/opsys/errno_id-1.html">errno_id / 1</A>
</BODY></HTML>
